package tests;

import common.Utils;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;

import java.io.IOException;

public class PageByNoLogin extends Utils {
    public static String listUrl = "http://123.60.62.52:9090/blog_list.html";
    public static String editUrl = "http://123.60.62.52:9090/blog_edit.html";
    public static String detailUrl = "http://123.60.62.52:9090/blog_detail.html";

    public PageByNoLogin() {
        super("");
    }

    /**
     * 异常登陆测试
     */


    /**
     * 列表页未登录测试
     */
    public void ListByNoLogin() throws InterruptedException, IOException {
        driver.get(listUrl);
        Thread.sleep(3000);
        Alert alert = driver.switchTo().alert();
        alert.accept();
    }

    /**
     * 博客编辑页未登录测试
     */
    public void EditByNoLogin() throws InterruptedException {
        driver.get(editUrl);
        driver.findElement(By.cssSelector("#title"));
        driver.findElement(By.cssSelector("#submit")).click();
        Thread.sleep(3000);
        Alert alert = driver.switchTo().alert();
        alert.accept();
        //driver.quit();
    }

    /**
     * 博客详情页未登录测试
     */
    public void DetailByNoLogin() throws InterruptedException {
        driver.get(detailUrl);
        Thread.sleep(3000);
        Alert alert = driver.switchTo().alert();
        alert.accept();
        driver.quit();
    }
}
